package cn.itsource.controller;

import cn.itsource.domain.User;
import cn.itsource.util.AjaxResult;
import org.springframework.web.bind.annotation.*;

@RestController
public class LoginController {
    //@RequestMapping(value = "/login",method = RequestMethod.POST)
    @PostMapping("/login")
    public AjaxResult login(@RequestBody User user){
        String username = user.getUsername();
        String password = user.getPassword();
        if("zgf".equals(username)&&"zgf".equals(password)){
            user.setPassword(null);
            return AjaxResult.me().setSuccess(true).setMessage("登陆成功！").setRestObj(user);
        }
        return AjaxResult.me().setSuccess(false).setMessage("登陆失败！");
    }
}
